import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import 'colors.dart';

/// @class : ButtonStyles

/// @description :ButtonStyles样式
class ButtonStyles {
  /// Button公共样式，默认点击效果
  /// [ButtonStyle]
  static ButtonStyle getButtonStyle() {
    return ButtonStyle(
      animationDuration: const Duration(milliseconds: 200),
      padding: MaterialStateProperty.all(const EdgeInsets.all(0)),
      shape: MaterialStateProperty.all(const StadiumBorder()),
    );
  }

  /// Button公共样式，无点击效果
  /// [ButtonStyle]
  static ButtonStyle getTransparentStyle() {
    return ButtonStyle(
      overlayColor: MaterialStateProperty.all(Colors.transparent),
    );
  }

  /// Button公共样式，无圆角
  /// [ButtonStyle]
  static ButtonStyle getNoShapeStyle() {
    return ButtonStyle(
      animationDuration: const Duration(milliseconds: 200),
      padding: MaterialStateProperty.all(const EdgeInsets.all(0)),
    );
  }

  static ButtonStyle loginStyle() {
    return ButtonStyle(
      backgroundColor: MaterialStateProperty.resolveWith<Color>((states) {
        if (states.contains(MaterialState.disabled)) {
          return Color(0xFFEDEEF5);
        }
        return ColorStyle.primaryTextColor;
      }),
      elevation: MaterialStateProperty.all(0),
      shape: MaterialStateProperty.all(RoundedRectangleBorder(
        // 边框圆角
        borderRadius: BorderRadius.circular(26.r),
      )),
    );
  }
}
